package base.io;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class TestBufferStream1 {
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream("d:\\dat.txt");
            BufferedInputStream bis = new BufferedInputStream(fis);
            int c = 0;
            System.out.println(bis.read());
            System.out.println(fis.read());
            bis.mark(100);
            for(int i=0;i<=10 && (c=bis.read())!=-1;i++){
                System.out.print(c+" ");
            }
            System.out.println();
            bis.reset();
            for(int i=0;i<=10 && (c=bis.read())!=-1;i++){
                System.out.print(c+" ");
            }
            bis.close();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }catch (IOException e1){
            e1.printStackTrace();
        }
    }
}
